﻿#include <iostream>
using namespace std;

class A
{
	public:
	int f() { return 45; }
	virtual int g() { return 69; }
};
class B : public A
{
	public:
	int f() { return 58; }
	virtual int g() { return 99; }
};
class C : public B
{
	public :
	int f() { return 68; }
	virtual int g() { return 35; }
};

int main()
{
	A *pa;
	B *pb;
	A a;
	B b;
	C c;
	pa = &a;
	pb = &b;
	cout << pa->f() << endl; // U t s k r i f t 1
	cout << pa->g() << endl; // U t s k r i f t 218 MAX SEVON
	pa = &b;
	cout << pa->f() << endl; // U t s k r i f t 3
	cout << pa->g() << endl; // U t s k r i f t 4
	pa = &c;
	cout << pa->f() << endl; // U t s k r i f t 5
	cout << pa->g() << endl; // U t s k r i f t 6
	pb = &c;
	cout << pb->f() << endl; // U t s k r i f t 7
	cout << pb->g() << endl; // U t s k r i f t 8
	system("pause");
	return 0;
}